bitkeeper revision 1.1188 (420d5244F1WAs2mvIW8E0-0RB5AlRw)
authoriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>
Sat, 12 Feb 2005 00:48:04 +0000 (00:48 +0000)
committeriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>
Sat, 12 Feb 2005 00:48:04 +0000 (00:48 +0000)
Subject: [PATCH] dm-destroy.patch

Clicking on the power off button calls xm destroy as well.

Signed-off-by: Arun Sharma <arun.sharma@intel.com>
Signed-off-by: ian@xensource.com
tools/ioemu/gui/gui.cc

index a6cd30732a54e92d20aacbe4ec66713b5ec2d684..d3c2383d1eeba82720a621760df79d3d0e8e539a 100644 (file)
@@ -293,6 +293,10 @@ bx_gui_c::reset_handler(void)
       BX_CPU(i)->reset(BX_RESET_HARDWARE);
 }
 
+#ifdef BX_USE_VMX
+char xm_destroy[PATH_MAX];
+#endif
+
   void
 bx_gui_c::power_handler(void)
 {
@@ -300,9 +304,14 @@ bx_gui_c::power_handler(void)
   // to quit.  Change panics to fatal for the GUI and then do a panic.
   bx_user_quit = 1;
   LOG_THIS setonoff(LOGLEV_PANIC, ACT_FATAL);
-  BX_PANIC (("POWER button turned off."));
+  BX_INFO(("POWER button turned off."));
   // shouldn't reach this point, but if you do, QUIT!!!
   fprintf (stderr, "Bochs is exiting because you pressed the power button.\n");
+  snprintf(xm_destroy, PATH_MAX, "xm destroy %d", domid);
+  BX_INFO(("executing: %s\n", xm_destroy));
+  if (system(xm_destroy) != 0) {
+        BX_PANIC(("failed\n"));
+  }
   BX_EXIT (1);
 }